﻿#ifndef SINGLETON_H
#define SINGLETON_H

#include <QObject>
#include <QtCore>
#include "AiPtuStruct.h"

class Singleton : public QObject
{
    Q_OBJECT
public:
    static Singleton *Instance();
    explicit Singleton(QObject *parent = nullptr);
    void onTextMessageReceived(const QString &message);

    void onBinaryMessageReceived(const QByteArray &message);

    void onSendParam(const QString &method, QJsonObject body);

    void  sendBinaryMessage(const QByteArray &message);

    AlarmExtern handleAlarmExtern(QJsonObject obj);
signals:
    void  sigsendRequest(const QString &method, int seq, QJsonObject body);

    void  sigsendBinaryMessage(const QByteArray &message);

    void sigSetNetworkParamSuccess();
    void sigSyncDateTimeSuccess();
    void sigSetAlarmInfoSuccess();
    void sigSetColidarPileCoalParamSuccess();
    void sigSetCoalSpdParamSuccess();
    void sigSetCoalSpdBaselineSuccess();

    void sigGetDeviceInfo(QJsonObject);
    void sigGetDeviceRunInfo(QJsonObject);
    void sigGetNetworkParam(QJsonObject);

    void sigGetAlgoParam(QJsonObject);
    void sigGetExternalParam(QJsonObject);
    void sigGetAlarmOut(QJsonObject);
    void sigGetZoneParam(QJsonObject);
    void sigGetAlgoInfo(QJsonObject);

    void  sigGetAlgoPeopleCountParam(QJsonObject);
    void sigCoalSpdValue(QJsonObject);
    void sigGetCoalSpdParam(QJsonObject);

    void sigGetCameraParam(QJsonObject);

    void sigGetBeltTearParam(QJsonObject);

    void sigGetPileCoalParam(QJsonObject);

    void sigGetColidarPileCoalParam(QJsonObject);

    void sigAppUpgrade(QJsonObject);

    void sigPeopleCountMaxChanged(QJsonObject);//2022.3.14
    void sigGetAlgoPeopleCountMaxByTime(QJsonObject);

    void sigGetbeltWidth(QJsonObject);//2022.3.18

    void sigGetCorrectZone(QJsonObject);

    void sigVoiceTalkOut(WsBinHeader header, QByteArray voice);
    void sigAlarmImage(WsBinHeader header, QByteArray image, AlarmExtern alarmExtern);

private:
    static QScopedPointer<Singleton> self;



    enum WSBIN_TYPE
    {
        WSBIN_TYPE_NULL = 0,
        WSBIN_TYPE_IMAGE,          // 实时图片、报警图片
        WSBIN_TYPE_FILE,           // 文件
        WSBIN_TYPE_SCREENSHOTS,    // 截图
        WSBIN_TYPE_VOICE,          // 音频文件
    };
};

#endif // SINGLETON_H
